/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Data.Diagram;
import java.awt.Graphics;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * The Mother Node of diagrams
 * @author Ryan :)
 */
public class Diagram implements DiagramInterface{
    private List<DiagramInterface> children;

    
    /**
     * Creates a Diagram object
     */
    public Diagram() {
        children = new ArrayList<DiagramInterface>(10);
    }
    
    /**
     * Draws all children of diagram using passed in graphics object
     * @param g
     */
    public void draw(Graphics g){
        for (Iterator<DiagramInterface> it = children.iterator(); it.hasNext();) {
            DiagramInterface diagramInterface = it.next();
            diagramInterface.draw(g);
        }
    }

    /**
     * Adds a child to this Mother Node
     * @param DI
     */
    public void add(DiagramInterface DI){
        children.add(DI);
    }

    /**
     * Removes any instances of the passed in child from Mother Node
     * @param DI
     */
    public void remove(DiagramInterface DI){
        throw new UnsupportedOperationException();
    }

}
